package com.wn.consumer.consumer4;

import lombok.extern.slf4j.Slf4j;
import org.springframework.amqp.core.ExchangeTypes;
import org.springframework.amqp.rabbit.annotation.Exchange;
import org.springframework.amqp.rabbit.annotation.Queue;
import org.springframework.amqp.rabbit.annotation.QueueBinding;
import org.springframework.amqp.rabbit.annotation.RabbitListener;
import org.springframework.stereotype.Component;

/**
 * @author yellow Docter
 * @date 2022 -08-31
 * @desc
 */
@Component
@Slf4j
public class Consumer02Q2 {

    /**
     *  * key的通配符:  * 一个单词
     *  # key的通配符:  0个或者多个单词
     *
     * @param msg
     */
    @RabbitListener(
            bindings = @QueueBinding(
                    value = @Queue(name = "Q2"),
                    exchange = @Exchange(
                            name = "exchange-topic",
                            type = ExchangeTypes.TOPIC
                    ),
                    key={
                        "*.*.rabbit",
                        "lazy.#",
                    }
            )
    )
    public void consumer(String msg){

        log.info("我消费了{}",msg);
    }

}
